library(plotly)
## Warning: package 'plotly' was built under R version 4.1.2
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.1.2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(ggplot2)
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
data("EuStockMarkets")
stocks<-as.data.frame(EuStockMarkets) %>%
  gather(index, price) %>%
  mutate(time=rep(time(EuStockMarkets), 4))
plot_ly( x=stocks$price, type="histogram")
plot_ly(y=stocks$price,color = stocks$index, type="box")
plot_ly(data=stocks,x=~ stocks$time,y=~stocks$price,color = ~stocks$index ,type="scatter",mode="markers")